package com.neusoft.neumooc.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.neusoft.core.common.BaseService;
import com.neusoft.core.common.exception.ServiceException;
import com.neusoft.neumooc.dao.ColumnDAO;
import com.neusoft.neumooc.vo.ColumnVO;

@Service
@Transactional
public class ColumnServiceImpl extends BaseService implements ColumnService {

    @Autowired
    private ColumnDAO columnDAO;
    
    @Override
    public List<ColumnVO> getAllColumns() throws ServiceException {
        try {
            return columnDAO.getAllColumns();
        } catch (Exception e) {
            log.error("获取栏目列表失败", e);
            throw new ServiceException("获取栏目列表失败", e);
        }
    }

    @Override
    public ColumnVO getColumnById(String colId) throws ServiceException {
        try {
            return columnDAO.getColumnById(colId);
        } catch (Exception e) {
            log.error("获取栏目失败", e);
            throw new ServiceException("获取栏目失败", e);
        }
    }

    @Override
    public boolean addColumn(ColumnVO column) throws ServiceException {
        try {
            return columnDAO.addColumn(column);
        } catch (Exception e) {
            log.error("添加栏目失败", e);
            throw new ServiceException("添加栏目失败", e);
        }
    }

    @Override
    public boolean updateColumn(ColumnVO column) throws ServiceException {
        try {
            return columnDAO.updateColumn(column);
        } catch (Exception e) {
            log.error("更新栏目失败", e);
            throw new ServiceException("更新栏目失败", e);
        }
    }

    @Override
    public boolean deleteColumn(String colId) throws ServiceException {
        try {
            return columnDAO.deleteColumn(colId);
        } catch (Exception e) {
            log.error("删除栏目失败", e);
            throw new ServiceException("删除栏目失败", e);
        }
    }
} 